Skip to content

fix: preserve VEX justification in applied ignore rules#3479

Open
toller892 wants to merge 1 commit into
anchore:mainfrom
toller892:fix/vex-justification-preserved
Open

fix: preserve VEX justification in applied ignore rules#3479
toller892 wants to merge 1 commit into
anchore:mainfrom
toller892:fix/vex-justification-preserved

Conversation

@toller892

Copy link
Copy Markdown

Fixes #2828

Problem

When a VEX not_affected or fixed statement matches a status-only ignore rule (e.g. - vex-status: not_affected without specifying vex-justification), the vex-justification field is missing from appliedIgnoreRules in the JSON output.

The root cause is in both openvex/implementation.go and csaf/implementation.go matchingRule functions: when a user-provided rule matches, it's returned as-is without enriching the VexJustification field from the VEX statement.

Additionally, in the CSAF implementation, the justification filter check (lines 209-214) was unreachable because the earlier return at line 206 exits before it.

Fix

Both OpenVEX and CSAF matchingRule functions now:

  1. Enrich returned rules with the statement's justification when VexJustification is empty
  2. In CSAF, move the justification filter check before the return so it's actually evaluated

This ensures status-only ignore rules correctly populate vex-justification from the matched VEX statement.

Testing

  • go test ./grype/vex/... ./grype/presenter/models/ -count=1 — all pass
  • Updated test expectations for CSAF tests that now correctly include the justification

When a VEX not_affected or fixed statement matches a status-only ignore
rule (no vex-justification specified), the matched rule now inherits the
justification from the VEX statement. Previously, the justification was
dropped, causing the vex-justification field to be missing from the
appliedIgnoreRules in JSON output.

Both OpenVEX and CSAF matchingRule functions now enrich returned rules
with the statement's justification when the rule's VexJustification is
empty. The CSAF justification filter (previously unreachable after an
early return) is now checked before enrichment.

Fixes anchore#2828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing vex-justification field in appliedIgnoreRules in JSON output

1 participant